Relational Model

▪Relational model properties

Relation heading ⇨ column headings Relation body ⇨ set of data rows ▪ No duplicate tuples – by definition sets do not contain duplicate elements ▪ Tuples are unordered within a relation – by definition sets are not ordered ▪ No ordering of attributes within a tuple – by definition sets are not ordered ▪ Tuple values are atomic - cannot be divided, no multivalued (repeating) attributes allowed

▪Keys

–Superkey An attribute or set of attributes which exhibits only the uniqueness property Is a key that can uniquely identify any row in the table. (可以确定其他所有的key) -Candidate Key candidate key is a minimal superkey 最小的superkey —that is, a superkey without any unnecessary attributes -Primary Key 必须只能选一个candidate key作为primary key即可 –Foreign Key An attribute or attributes in one table whose values must match the primary key in another table or whose values must be null. (一个表中的一个或多个键是另一个表中的主键,这个键叫外键) A Foreign Key value must either match the full primary key in a relation or be NULL.

▪Data Integrity

--Entity integrity: Primary key value must not be NULL. --Referential integrity: The values of FK must either match a value of a full PK in the related relation or be NULL. --Column/Domain integrity: All values in a given column must come from the same domain

▪Relational Algebra

SELECT (or RESTRICT) only uses one table as input;an operator used to select a subset of rows. 选出一行或几行 (sigma) PROJECT:an operator used to select a subset of columns. (pai) 重复的值只取一次 JOIN |X|

–Understanding of efficiency

Addition Functional Dependency: – A set of attributes A functionally determines an attribute B if, and only if, for each A value, there is exactly one value of B in the relation NULL: NULL is NOT a value - is a representation of the fact that there is NO VALUE